import request from '@/utils/request'

export default {
    getLeaveList(id) {
        return request({
            url: `/leave/${id}`,
            method: "get",
        })
    },
    addLeave(leave) {
        return request({
            url: "/leave/addleave",
            method: "post",
            data: leave
        })
    },
    saveLeave(leave) {
        if (leave.id == null || leave.id == undefined) {
            return this.addLeave(leave)
        }
        return this.updateLeave(leave)
    },
    updateLeave(leave) {
        return request({
            url: '/leave/updateleave',
            method: "put",
            data: leave
        })
    },
    getLeaveMsg(id) {
        return request({
            url: `/leave/leavemsg/${id}`,
            method: "get",
        })
    },
    deleteLeaveById(id) {
        return request({
            url: `/leave/deletleave/${id}`,
            method: "delete",
        })
    },
    getLeaveAllList() {
        return request({
            url: `/leave/all`,
            method: "get",
        })
    }
}